package com.itheima.pool.service;

import com.itheima.pool.dao.StudentDao;
import com.itheima.pool.dao.StudentDaoImpl;
import com.itheima.pool.domain.Student;
import org.junit.Test;

import java.sql.SQLException;
import java.util.ArrayList;

public class StudentServiceImpl implements StudentService {
    StudentDao studentDao = new StudentDaoImpl();
    @Override
    @Test
    public ArrayList<Student> findAll() throws SQLException {
        ArrayList<Student> list = studentDao.findAll();
        return list;
    }

    @Override
    public Student findById(Integer id) throws SQLException {
        Student student = studentDao.findById(id);
        return student;
    }

    @Override
    public int insert(Student student) throws SQLException {
        int insert = studentDao.insert(student);
        return insert;
    }

    @Override
    public int update(Student student) throws SQLException {
        int update = studentDao.update(student);
        return update;
    }

    @Override
    public int delete(Integer id) throws SQLException {
        int delete = studentDao.delete(id);
        return delete;
    }
}
